package com.neu.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.neu.entity.User;
import com.neu.mapper.UserMapper;
import com.neu.service.UserService;




@Service("userServiceImpl")
@Transactional
public class UserServiceImpl implements UserService{
	@Autowired
	private UserMapper userMapper;

	@Override
	public List<User> getUserList(Integer page, Integer count, String keywords) {
		// TODO Auto-generated method stub
		return userMapper.getUserList(page, count, keywords);
	}

	@Override
	public Map<String, Object> getUserList_Map(Integer page, Integer count, String keywords) {
		// TODO Auto-generated method stub
		Map<String,Object> map = new HashMap<>();
		List<Map<String,Object>>list =  userMapper.getUserList_Map(page, count, keywords);
		map.put("list", list);

		return map;
	}

	@Override
	public List<User> getUserList02(Integer page, Integer count, String keywords, String keywords02,
			String keywords03) {
		// TODO Auto-generated method stub
		return userMapper.getUserList02(page, count, keywords, keywords02, keywords03);
	}

	@Override
	public int getUserCount(String keywords) {
		// TODO Auto-generated method stub
		return userMapper.getUserCount(keywords);
	}

	@Override
	public int getUserCount02(String keywords, String keywords02, String keywords03) {
		// TODO Auto-generated method stub
		return userMapper.getUserCount02(keywords, keywords02, keywords03);
	}

	@Override
	public int deleteUserById(int id) {
		// TODO Auto-generated method stub
		return userMapper.deleteUserById(id);
	}

	@Override
	public int deleteUserByIds(Integer[] ids) {
		// TODO Auto-generated method stub
		return userMapper.deleteUserByIds(ids);
	}

	@Override
	public int addUser(User user) {
		// TODO Auto-generated method stub
		int row = userMapper.addUser(user);
		 return row;
	}

	@Override
	public int updateUserById(User user) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public boolean login02(String keywords, String keywords02) {
		// TODO Auto-generated method stub
		int go  = userMapper.login02(keywords, keywords02);
		boolean flag = false;
		if(go == 1) {
			flag  = true;
		}else if(go == 0) {
			flag = false;
		}
		return flag;
	}

	@Override
	public User getUserBean(String keywords, String keywords02) {
		
		 User user = userMapper.getUserBean(keywords, keywords02);
		return user;
	}

	@Override
	public int checkRepeat(User user) {
		// TODO Auto-generated method stub
		return 0;
	}
	
	


}
